/*****************************************************************************//*!
* file  : test.c
* creat : apleilx
* data  : 2017/11/05
*******************************************************************************/

#include "osObjects.h"
#include "pincfg.h"
#include "pcf8574.h"

#define _SYSTASK_MODULE_
#include "systask.h"
#undef _SYSTASK_MODULE_

/*****************************************************************************//*!
*
* @brief   storage task.
*     
* @param   none
*
* @return  none
*
* @ Pass/ Fail criteria: none
*****************************************************************************/
void SysTask(void *argument)
{
    OS_ERR      os_err;
    CPU_TS      cpu_ts;

#if OS_CFG_STAT_TASK_EN > 0u
    OSStatTaskCPUUsageInit(&os_err);                               /* Compute CPU capacity with no task running            */
#endif
    
    OSTimeDly (200, OS_OPT_TIME_DLY, &os_err);
    
    PCF8574_Init();

    ExtOutSt = 0xFF;
    
    for(;;){
        //if(BeepOutSt())
         //   BeepOut(0);
        //else
            BeepOut(1);
            UsbPowerOut(1);
		OSTimeDly (500, OS_OPT_TIME_DLY, &os_err);
        
        OSMutexPend (&MutexObjI2C, 500,  OS_OPT_PEND_BLOCKING, &cpu_ts, &os_err);
        ExtOutSt |= EXTIO_INPUTMSK;
        PCF8574_WriteOneByte(ExtOutSt);
        ExtInSt=PCF8574_ReadOneByte();
        OSMutexPost (&MutexObjI2C,  OS_OPT_POST_NONE, &os_err);
        

    }
}






